﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ilanver.Core.CommonValidator;

namespace ilanver.Core.DomainModel
{
    [Serializable]
    public abstract class ValidatableObject : BaseObject, IValidatable
    {
        private IValidator Validator
        {
            get
            {
                return SafeServiceLocator<IValidator>.GetService();
            }
        }

        public bool IsValid()
        {
            return Validator.IsValid(this);
        }

        public ICollection<IValidationResult> ValidationResults()
        {
            return Validator.ValidationResultsFor(this);
            return Validator.ValidationResultsFor(this);
        }
    }
}
